feat: add getProjectWalletsByTag and normalize wallet shape#127
Merged
Conversation
- Add `getProjectWalletsByTag(tag)` on `WalletDeveloperControlled`, consuming the existing `GET /api/project-wallet/:projectId/tag/:tag` endpoint. URL-encodes the tag and rejects empty/whitespace input. - Add `normalizeWalletInfo` helper that maps the backend's flat `Web3ProjectWallet` response (top-level `pubKeyHash`, `stakeCredentialHash`) into the SDK's nested `MultiChainWalletInfo` shape. Apply it in `getProjectWallet` and `getProjectWalletsByTag`, replacing the unsafe `data as MultiChainWalletInfo` casts that previously left `walletInfo.chains.cardano.*` undefined for callers. Spark is intentionally omitted because the backend doesn't persist Spark public keys. - Drop the dead `walletInfo.chains.spark` gate in `getWallet`. Spark wallets are derived entirely from the mnemonic; the gate previously prevented the spark branch from ever running in production. - Update tests to mock the actual flat backend shape and assert the normalized output. 40/40 passing. Bumps version 0.2.0 -> 0.2.1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Main shipped 0.2.1 in #126; this branch's 0.2.1 collides, so bump to 0.2.2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sdk.wallet.getProjectWalletsByTag(tag)toWalletDeveloperControlled, consuming the existingGET /api/project-wallet/:projectId/tag/:tagbackend endpoint.getProjectWalletandgetProjectWalletsByTag: the backend returns a flatWeb3ProjectWallet(pubKeyHash,stakeCredentialHashat top level) but the SDK was casting it as the nestedMultiChainWalletInfo(chains.cardano.*). Any caller readingwallet.chains.cardano.pubKeyHashpreviously gotundefined. AnormalizeWalletInfohelper now maps flat → nested at the SDK boundary. Spark is intentionally omitted because the backend doesn't persist Spark public keys.walletInfo.chains.sparkgate ingetWallet. Spark wallets derive entirely from the mnemonic; the gate prevented the spark branch from ever running in production.0.2.0→0.2.1.API
team/alpha beta→team%2Falpha%20beta)MultiChainWalletInfo[]withchains.cardanopopulatedOut of scope (deferred)
getProjectWallets(paginated list) has a separate envelope-shape bug — SDK expects{data, pagination}but the backend returns a flat array. Not touched here./api/project-walletsilently dropschains.spark— would require a Prisma schema migration.Test plan
pnpm jest src/sdk/wallet-developer-controlled/index.test.ts— 40/40 passing🤖 Generated with Claude Code